﻿CREATE PROCEDURE [dbo].[GetLastWorkedDate]
@UserID INT
AS
DECLARE @LastWorkedDate DATETIME

SELECT	@LastWorkedDate = COALESCE(Max(EntryDate), DATEADD(DAY, -1, GETDATE()))
FROM	EntryLog
WHERE	UserID = @UserID

SELECT @LastWorkedDate


